# if
cars = ['audi', 'bmw', 'subaru', 'toyota']
for car in cars:
    if car == 'bmw':
        print(car.upper())
    else:
        print(car.title())

# birth_str = input('birth：')
# birth = int(birth_str)
# if birth > 2000:
#     print('00后')
# else:
#     print('00前')

# 练习,小明身高1.75，体重80.5kg。请根据BMI公式（体重除以身高的平方）帮小明计算他的BMI指数
height = 1.75
weight = 80.5

bmi = 80.5 / 1.75 ** 2
if bmi <= 18.5:
    print('过轻')
elif 18.5 < bmi <= 25:
    print('正常')
elif 25 < bmi <= 28:
    print('过重')
elif 28 < bmi <= 32:
    print('肥胖')
else:
    print('严重肥胖')

# 如果要针对某个变量匹配若干种情况，可以使用match语句
score = 'B'
if score == 'A':
    print('score is A.')
elif score == 'B':
    print('score is B.')
elif score == 'C':
    print('score is C.')
else:
    print('invalid score.')

# 3.10版本后的才有
match score:
    case 'A':
        print('score is A.')
    case 'B':
        print('score is B.')
    case 'C':
        print('score is C.')
    case _:
        print('score is ???.')

age = 15

match age:
    case x if x < 10:
        print(f'< 10 years old: {x}')
    case 10:
        print('10 years old.')
    case 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18:
        print('11~18 years old.')
    case 19:
        print('19 years old.')
    case _:
        print('not sure.')
